import datetime
import time

# 获取当前时间 2023-04-27  11:02:10.500828
now_time = datetime.datetime.now()
print(now_time)

# 时间的加减
# days = 天，seconds = 秒，minutes = 分钟，hours = 小时，weeks = 周
res = now_time + datetime.timedelta(weeks=3)
print(res)

# 时间的替换
# year,month,day,hour,minute,second
res2 = res.replace(year=2000) # 将年份修改为2000
print(res2)
# 将时间戳修改为日期格式
res3 = datetime.date.fromtimestamp(time.time())
print(res3)
